package com.zlb.demo.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zlb.demo.domain.FamilyInfo;
import com.zlb.demo.domain.R;
import com.zlb.demo.domain.vo.DetailVO;
import com.zlb.demo.domain.vo.FamilyInfoSaveVO;
import com.zlb.demo.domain.vo.FamilyInfoQueryVO;
import com.zlb.demo.service.IFamilyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * @Description
 * @Author zlb
 * @Since 2024-03-19 22:02:26
 */
@RestController
@RequestMapping("/v1/m/familyInfo")
public class FamilyInfoController {

    @Autowired
    private IFamilyInfoService familyInfoService;

    @GetMapping
    public R<Page<FamilyInfo>> page(FamilyInfoQueryVO queryVO) {
        return R.ok(familyInfoService.page(queryVO));
    }

    @PostMapping
    public R<Boolean> save(@RequestBody FamilyInfoSaveVO vo) {
        return R.ok(familyInfoService.save(vo), "新增成功");
    }

    @DeleteMapping("/{ids}")
    public R<Boolean> deleteByIds(@PathVariable Long[] ids) {
        return R.ok(familyInfoService.deleteByIds(ids), "删除成功");
    }

    @GetMapping("/{id}")
    public R<DetailVO> detail(@PathVariable("id") Long id) {
        return R.ok(familyInfoService.detail(id));
    }


}
